<?php

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/

/**
 * 填充用户
 */
$factory->define(App\User::class, function (Faker\Generator $faker) {
    return [
        'user_name' => $faker->name,
        'email' => $faker->email,
        'password' => bcrypt(str_random(10)),
        'create_time' => rand(1451577600, 1483200000), //从2016.1.1开始到2017.1.1的随机时间戳
        'update_time' => null,
        'status' => rand(0,1),
        'is_admin' => rand(0,1),
    ];
});

/**
 * 填充留言
 */
$factory->define(App\Comment::class, function (Faker\Generator $faker) {
    return [
        'uid' => App\User::select('id')->get()->random()->id,
        'text' => $faker->realText($maxNbChars = 100, $indexSize = 2),
        'create_time' => rand(1487001600, time()), //从2017.2.14开始到当前时刻的随机时间戳
    ];
});
